<template>
  <el-dialog
    title="版本信息"
    :visible.sync="dialogVisible"
    :append-to-body="true"
    width="800"
    @close="close"
    :close-on-click-modal="false"
    center
  >
    <div v-loading="loading" class="lversion-con">
      <div class="logo clearfix">
        <img class="head-logo f-l" src="~@/assets/img/logo.png" />
        <span class="head-text f-l"> {{ versionform.systemName }}</span>
      </div>
      <el-form
        :inline-message="false"
        :status-icon="true"
        :model="versionform"
        label-width="120px"
        size="large"
        :hide-required-asterisk="true"
        class="ser-form ope-form"
        :v-loading="loading"
      >
        <el-row>
          <el-col>
            <el-form-item label="系统名称：">
              {{ versionform.systemName }}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="版本信息：">
              {{ versionform.systemVersion }}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="系统版权：">
              {{ versionform.systemLicense }}
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="version-title">版本历史信息</div>
      <el-table
        :data="versionData"
        size="mini"
        border
        tooltip-effect="light"
        empty-text=""
        style="width: 100%"
        max-height="300"
        class="custom-table"
      >
        <el-table-column
          :resizable="false"
          type="index"
          label="序号"
          min-width="100"
          align="center"
        ></el-table-column>

        <el-table-column label="版本更新时间" min-width="250" align="center">
          <template slot-scope="scope">
            {{ scope.row.versionTime }}
          </template>
        </el-table-column>
        <el-table-column label="版本更新" min-width="250" align="center">
          <template slot-scope="scope">
            {{ scope.row.systemVersion }}
          </template>
        </el-table-column>
      </el-table>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="close">取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  name: 'version',
  data() {
    return {
      dialogVisible: false,
      versionform: {},
      loading: false,
      versionData: [],
    };
  },
  methods: {
    close() {
      this.dialogVisible = false;
    },
    show(options) {
      this.dialogVisible = true;
    },
    open() {
      this.$nextTick(() => {
        this.loadData();
      });
    },
    loadData() {
      this.loading = true;
      this.$api.head.getVersion
        .call(this)
        .then((res) => {
          if (res.data.code === 200) {
            this.versionform = res.data.data[0];
            this.versionData = res.data.data;
            this.loading = false;
          } else {
            this.loading = false;
          }
        })
        .catch(() => {
          this.loading = false;
        });
    },
  },
};
</script>
<style scoped>
.lversion-con /deep/ .el-form-item {
  margin-bottom: 5px !important;
}
.head-logo {
  width: 40px;
  height: 40px;
  display: inline-block;
}
.logo {
  text-align: center;
}
.head-text {
  font-size: 23px;
  vertical-align: middle;
}
.version-title {
  color: #78cbf2;

  font-size: 18px;
  padding-bottom: 20px;
}
</style>
